﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;

public partial class Admin_UserControl_Banner : System.Web.UI.UserControl
{
    private VI_TRI_QUANG_CAO viTriQuangCao;

    public VI_TRI_QUANG_CAO ViTriQuangCao
    {
        get { return viTriQuangCao; }
        set
        {
            viTriQuangCao = value;
            if(value != null)
            {
                pnl.Height = viTriQuangCao.Heigth.Value;
                pnl.Width = viTriQuangCao.Width.Value;
                AdRotator1.Height = viTriQuangCao.Heigth.Value;
                AdRotator1.Width = viTriQuangCao.Width.Value;
                Image1.ImageUrl = viTriQuangCao.ImageDefault;

                LinQ_RaoVatDataContext linQ = new LinQ_RaoVatDataContext();
                var query = linQ.QUANG_CAOs.Where(p => p.MaViTri == viTriQuangCao.MaViTri && p.Deleted == false);

                QuangCao = query.Where(qc=> qc.Deleted == false).ToList();

            }
            ;
        }
    }

    private List<QUANG_CAO> quangCao;

    public List<QUANG_CAO> QuangCao
    {
        get { return quangCao; }
        set
        {
            quangCao = value;
            if (value != null)
            {
                if (quangCao.Count > 0)
                {
                    AdRotator1.DataSource = quangCao;
                    AdRotator1.DataBind();
                    Image1.Visible = false;
                }
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {

    }
}
